package com.koal.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultBean {

    public int code;
    public String message;
    public Object obj;

    /**
     * 返回成功结果
     * @param message
     * @return
     */
    public static ResultBean success(String message) {
        return new ResultBean(200,message,null);
    }

    /**
     * 返回成功结果
     * @param message
     * @param obj
     * @return
     */
    public static ResultBean success(String message,Object obj) {
        return new ResultBean(200,message,obj);
    }

    /**
     * 返回失败结果
     * @param message
     * @return
     */
    public static ResultBean error(String message) {
        return new ResultBean(500,message,null);
    }


    /**
     * 返回失败结果
     * @param message
     * @param obj
     * @return
     */
    public static ResultBean error(String message,Object obj) {
        return new ResultBean(500,message,obj);
    }
}
